﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>CompleteInfo</title>
    <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/Scripts/js/jquery.min.js"></script>
    <script src="~/Scripts/js/bootstrap.min.js"></script>
</head>
<body style="background-color:#f1ebeb">
    <div id="NormalPage" class="container" style="width:1000px;position:absolute;margin-left:13%;margin-top:50px;font-weight:bolder">
        <form action="/Employee/CompleteInfoDo" method="post" enctype="multipart/form-data">
            <div class="row table-bordered text-center"><h1><b style="color:red;padding:20px">请完善基础信息</b></h1></div>
            <div class="row">
                <div class="col-md-11 table-bordered">
                    <div class="row text-center">
                        <div class="col-md-1 table-bordered" style="line-height:50px;">姓名：</div>
                        <div class="col-md-2 table-bordered" style="height:52px;"><label style="line-height:50px;">@ViewBag.EmployeeName</label></div>
                        <div class="col-md-2 table-bordered" style="line-height:50px;">年龄：</div>
                        <div class="col-md-3 table-bordered" style="height:52px;"><input type="text" id="txtAge" name="Age" style="margin-top:12px" /></div>
                        <div class="col-md-2 table-bordered" style="line-height:50px;">性别：</div>
                        <div class="col-md-2 table-bordered" style="line-height:50px;">
                            <input type="radio" value="男" checked="checked" name="Sex" />男
                            <input type="radio" value="女" name="Sex" style="margin-left:20px;" />女
                        </div>
                    </div>
                    <div class="row text-center">
                        <div class="col-md-3 table-bordered" style="line-height:50px;">学历：</div>
                        <div class="col-md-3 table-bordered" style="line-height:50px;"><select id="txtEducationID" style="width:120px;" name="EducationID"></select></div>
                        <div class="col-md-3 table-bordered" style="line-height:50px;">政治面貌：</div>
                        <div class="col-md-3 table-bordered" style="line-height:50px;"><select name="PoliticalID" style="width:120px;" id="txtPoliticalID"></select></div>
                    </div>
                </div>
                <div class="col-md-1 table-bordered" style="height:106px;">
                    <input type="file" name="file" style="position:absolute;" />
                    <img id="img1" style="position:absolute;width:100%;height:104px;margin-left:-15px;" />
                </div>
            </div>
            <div class="row text-center">
                <div class="col-md-3 table-bordered" style="line-height:90px;">学位：</div>
                <div class="col-md-9 table-bordered"><textarea id="txtDegree" name="Degree" style="height:45px;width:500px;margin:20px"></textarea></div>
            </div>
            <div class="row text-center">
                <div class="col-md-3 table-bordered" style="line-height:90px;">行业背景：</div>
                <div class="col-md-9 table-bordered"><textarea id="txtIndustryBack" name="IndustryBack" style="height:45px;width:500px;margin:20px"></textarea></div>
            </div>
            <div class="row text-center">
                <div class="col-md-3 table-bordered" style="line-height:90px;">技术特长：</div>
                <div class="col-md-9 table-bordered"><textarea id="txtSpecialty" name="Specialty" style="height:45px;width:500px;margin:20px"></textarea></div>
            </div>
            <div class="row">
                <div class="col-md-12"><input id="btnSubmit" type="submit" value="提交" class="btn-link pull-right" style="font-size:x-large;margin-top:20px;margin-right:50px;" /></div>
            </div>
        </form>
    </div>

    <div id="AlertInfo">

    </div>
</body>
</html>
<script>
    var state = '@ViewBag.id';
    switch (state) {
        case "0":
            location.href = '/Employee/Index';
            break;
        case "-1":
            $("#NormalPage").show();
            $("#AlertInfo").hide();
            break;
        case "1":
            $("#NormalPage").hide();
            $("#AlertInfo").show();
            $("#AlertInfo").html("<h2>正在审核中，请稍等。。。</h2>")
            break;
        case "2":
            $("#NormalPage").hide();
            $("#AlertInfo").show();
            $("#AlertInfo").html("<h2>信息核对失败，请重新提交。<a href='/Employee/CompleteInfo'>点击进入</a></h2>")
            break;
        default:
            location.href = '/Employee/Login';
    }
    LoadEducation();
    LoadPolitical();

    //加载学历
    function LoadEducation() {
        $.ajax({
            type: "post",
            url: "/Employee/GetEducationList",
            success: function (obj) {
                obj = JSON.parse(obj);
                var str = "";
                for (var i = 0; i < obj.length; i++) {
                    str += "<option value='" + obj[i].EducationID + "'>" + obj[i].EducationName + "</option>"
                }
                $("#txtEducationID").html("<option value='0'>请选择</option>" + str);
            }
        })
    }

    //加载政治面貌
    function LoadPolitical() {
        $.ajax({
            type: "post",
            url: "/Employee/GetPoliticalList",
            success: function (obj) {
                obj = eval("" + obj + "");
                var str = "";
                for (var i = 0; i < obj.length; i++) {
                    str += "<option value='" + obj[i].PoliticalID + "'>" + obj[i].PoliticalName + "</option>"
                }
                $("#txtPoliticalID").html("<option value='0'>请选择</option>" + str);
            }
        })
    }

    $.ajax({
        type: "post",
        url: "/Employee/BackFill",
        success: function (obj) {
            if (obj != "") {
                obj = JSON.parse(obj);
                $("#txtAge").val(obj.Age);
                $("[name='Sex'][value='" + obj.Sex + "']").prop("checked", true);
                $("#img1").prop("src", obj.EmployeePhoto);
                $("#txtEducationID").val(obj.EducationID);
                $("#txtDegree").val(obj.Degree);
                $("#txtPoliticalID").val(obj.PoliticalID);
                $("#txtIndustryBack").val(obj.IndustryBack);
                $("#txtSpecialty").val(obj.Specialty);
            }
        }
    })
</script>